feat(core,runtime,desktop): declare thinking levels on Anthropic-protocol relays - #3686
Open
qian0817 wants to merge 1 commit into
Open
feat(core,runtime,desktop): declare thinking levels on Anthropic-protocol relays#3686qian0817 wants to merge 1 commit into
qian0817 wants to merge 1 commit into
Conversation
…ocol relays An anthropic-compatible relay fronts models the metadata chain cannot resolve (no provider alias exists for it), so its models offered no thinking menu at all — while the declaration mechanism that would fix it was gated OpenAI-relay-only since apache#2463. The gate is now per-field rather than per-provider: thinking-level declarations are legal on all three custom relays, serviceTier stays OpenAI Responses-only. The declarable vocabulary is per provider: `off` joins it only for anthropic-compatible, whose protocol has a true disable wire (`thinking: { type: 'disabled' }`); the OpenAI relays keep their vocabulary unchanged (`off` there encodes `reasoning_effort: 'none'`, which no generic relay is presumed to honor). - `DECLARABLE_RELAY_THINKING_LEVELS` becomes `declarableRelayThinkingLevels(providerType)`; normalize gains an optional provider and stays provider-blind without one (the host-wire decode edge has no provider context — the canonical store codec has already validated fit). - The catalog codec asserts field-level provider fit, and the update path threads providerType through to table decode. - The runtime anthropic wire maps a declared `off` to `thinking.disabled` and other tiers to a passthrough `effort`. - The settings page's thinking menu, bulk control, and draft seed use the per-provider vocabulary (the same controls the OpenAI relays already expose). Older builds reject a document carrying these declarations (same forward-compat posture as apache#3309's serviceTier); SCHEMA_VERSION stays 1, matching the repo convention that value-range growth is not a schema change. Generated-by: Claude Sonnet 4.5 via pi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
An
anthropic-compatiblerelay fronts models the built-in metadata chain cannot resolve (no provider alias exists for it), so its models offered no thinking menu at all — while the per-model declaration mechanism that would fix it (relayModelProfiles.thinkingLevels, #2463) was gated OpenAI-relay-only.This PR opens that gate for
anthropic-compatible:serviceTierstays OpenAI Responses-only.offjoins it only foranthropic-compatible, whose protocol has a true disable wire (thinking: { type: 'disabled' }). The OpenAI relays keep their vocabulary unchanged (offthere encodesreasoning_effort: 'none', which no generic relay is presumed to honor).DECLARABLE_RELAY_THINKING_LEVELSbecomesdeclarableRelayThinkingLevels(providerType);normalizeRelayModelProfilesgains an optional provider argument and stays provider-blind without one (the host-wire decode edge has no provider context — the canonical store codec has already validated fit).providerTypethrough to table decode.offtothinking.disabledand other tiers to a passthrougheffort.isRelayProviderTypetype predicate now covers all three relay providers.Breaking change (forward compatibility, same posture as #3309's
serviceTier): older builds reject a catalog document carrying these declarations.SCHEMA_VERSIONstays 1, matching the repo convention that value-range growth is not a schema change. Worth a release-note line: clear Anthropic-relay thinking declarations before downgrading.Verification
packages/core: clean build + full suite pass (22/22 in the touched suites; per-provider vocabulary, codec field-level fit incl.offaccept/reject on both relay families, update-path positive case)packages/runtime: clean rebuild + full suite pass — 2987 pass / 0 fail (incl. wire-shape tests: declaredoff→thinking.disabled, effort passthrough, undeclared models emit nothing)packages/runtime-host: 1119 pass / 0 failapps/desktop:npm test1340 pass / 0 fail;typecheckclean (incl. draft-seed per-provider sanitation and the bulk-control vocabulary)packages/storage: 903/904 — the single failure (managed-dependency-environment-crash) reproduces on a clean checkout without these changes (environment-sensitive SQLite crash harness), verified via stash comparisonbiome checkclean on all touched filesrgon PATH; test runs in the repo's parallel CI-style harness without it fail onspawn rg ENOENTfor pre-existing environment reasons unrelated to this changeReview focus
The trilayer consistency — vocabulary (
model-thinking.ts) / codec (connection-catalog-codec.ts) / wire (model-factory.ts) — is the invariant to check:offis declarable only where the provider has a true disable wire, and only that provider's runtime branch can emit it.AI use
Select exactly one:
Tool(s) and scope: Claude Sonnet 4.5 via pi — implementation, tests, and PR description, following a human-approved design (field-level gate, manual declarations only,
offsupported). Commits carry aGenerated-bytrailer.Checklist
Does this PR entail a change in behavior?